<?php $id="form_".uniqid();?>
<table id="<?php echo $id;?>"></table>
<script>
    $("#<?php echo $id;?>").DataSource({url:'cash/get_payment_list',
        fields:[[
            {field:'site_name',      title:'来源网址', align:'center',  width:120,sortable:true},
            {field:'user_level',   title:'层级', align:'center', width:80, sortable:true},
            {field:'username',title:'会员账号',align:'center', width:100,  sortable:true},
            {field:'is_first',title:'首次', align:'center', width:80,  sortable:true},
            {field:'limit_money',    title:'提款额度', align:'center', width:80,sortable:true},
            {field:'charge_fee', title:'手续费', align:'center', width:80, sortable:true},
            {field:'coupon_money',   title:'优惠金额', align:'center', width:80, sortable:true},
            {field:'manage_fee',  title:'行政费',align:'center', width:80,  sortable:true},
            {field:'pay_fee',title:'出款金额',align:'center',width:80, sortable:true},
            {field:'money',  title:'账户余额', align:'center', width:80,  sortable:true},
            {field:'coupon',  title:'优惠扣除',align:'center',  width:80,  sortable:true},
            {field:'payment_date',  title:'出款日期',align:'center', width:150,  sortable:true},
            {field:'audit',  title:'稽核', align:'center',width:80,  sortable:true},
            {field:'status',  title:'状态', align:'center', width:180,  sortable:true, formatter:function(v, r){
                var str = '';
                if (r.status == '1') {
                    str += '<span style="color:green;">已出款</span>';
                } else if (r.status == '2') {
                    str += '<span style="color:palevioletred;">已出款</span>';
                } else if (r.status == '3') {
                    str += '<span style="color:red;">已取消</span>';
                } else {
                    if (r.status == '4') {
                        str += '<span style="color:green;">预备出款</span>&nbsp;';
                    } else if (r.status == '5') {
                        str += '<span style="color:green;">正在出款</span>&nbsp;';
                    }

                    str += '<a herf="#" class="btn btn-danger btn-xs" onclick=payment_edit('+r.id+');>确定</a>&nbsp;'+
                        '<a herf="#" class="btn btn-danger btn-xs" onclick=payment_cancel('+r.id+')>取消</a>&nbsp;'+
                        '<a herf="#" class="btn btn-danger btn-xs" onclick=payment_refuse('+r.id+')>拒绝</a>&nbsp;';
                }

                return str;
              }},
            {field:'op',  title:'操作者', align:'center', width:80,  sortable:true}
        ]], tools:[
            {instant:false},
            {type:'combobox',text:'层级',width:100,name:'level',value:'', items:'<option value="">全部</option><option value="1">未分层</option><option value="1">超级VIP</option><option value="1">至尊VIP</option><option value="1">送优惠客户</option>'},
            {type:'combobox',text:'层级',width:100,name:'status',value:'', items:'<option value="">全部</option><option value="1">处理中</option><option value="1">已确认</option><option value="1">已取消</option><option value="1">已拒绝</option>'},
            {type:'datebox', text:'日期',   width:100,name:'qaddtime'},
            {type:'datebox', text:'-',     width:100,name:'zaddtime'},
            {type:'textbox', text:'金额',   width:50,name:'qaddtime'},
            {type:'textbox', text:'-',     width:50,name:'zaddtime'},
            {type:'textbox', text:'账号',     width:50,name:'zaddtime'},
            {type:'combobox',text:'出款来源',width:100,name:'verify_status',value:'', items:'<option value="">全部</option><option value="1">PC端</option><option value="1">IOS端</option><option value="1">安卓端</option><option value="1">WAP端</option>'},
            {text:"搜索", iconCls:"icon-search", handler:function(){
                $('#<?php echo $id?>').DataSource('search');
            }},
            '|',
                {text:'导出',iconCls:'icon-large-chart',handler:function(){
                    var params=$('#<?php echo $id?>').DataSource('queryParams');
                    Core.Export(params,'cash/export');
                }},
            {type:'label', text:'', html:'<input type="radio" value="1" name="ls">&nbsp;铃声1&nbsp;&nbsp;', width:50},
            {type:'label', text:'铃声1', html:'<input type="radio" value="2" name="ls">&nbsp;铃声2&nbsp;', width:50},
            {text:'根据每个客服管理帐号自定义铃声',handler:function(){
                Core.dialog('自定义铃声', 'cash/ring_setting', function(){}, true, '340px');
            }},
        '-'
        ],
        edit:true,
        footer:true,
        checkbox:false,
        success:function(){

        }
    });

    function payment_edit(id)
    {
        //发送http请求
        $('#<?php echo $id?>').datagrid('reload');
    }

    function payment_cancel(id)
    {
        Core.dialog('取消备注(不超过100个字)','cash/payment_cancel',function(){},true,false);
        $('#<?php echo $id?>').datagrid('reload');
    }

    function payment_refuse(id)
    {
        $('#<?php echo $id?>').datagrid('reload');
    }
</script>